{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Notebook for preparing and saving GraphTheoryProp graphs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import torch\n",
    "import pickle\n",
    "import time\n",
    "import os\n",
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Download GraphTheoryProp dataset\n",
    "Actual source https://github.com/lukecavabarrett/pna"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "File already downloaded\n"
     ]
    }
   ],
   "source": [
    "if not os.path.isfile('multitask_dataset.pkl'):\n",
    "    print('downloading..')\n",
    "    !curl https://www.dropbox.com/s/zdevjruk7k6yuqc/multitask_dataset.pkl?dl=1 -o multitask_dataset.pkl -J -L -k\n",
    "else:\n",
    "    print('File already downloaded')\n",
    "    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Convert to DGL format and save with pickle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "os.chdir('../../') # go to root folder of the project\n",
    "print(os.getcwd())\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING:root:The OGB package is out of date. Your version is 1.2.3, while the latest version is 1.3.1.\n"
     ]
    }
   ],
   "source": [
    "import pickle\n",
    "\n",
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "from data.graphtheoryprop import GraphTheoryPropDatasetDGL \n",
    "\n",
    "from data.data import LoadData\n",
    "from torch.utils.data import DataLoader\n",
    "from data.graphtheoryprop import GraphTheoryPropDataset\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "preparing graphs for the TRAIN set...\n",
      "preparing graphs for the VAL set...\n",
      "preparing graphs for the TEST set...\n",
      "Time taken: 4.2379s\n"
     ]
    }
   ],
   "source": [
    "DATASET_NAME = 'GraphTheoryProp'\n",
    "dataset = GraphTheoryPropDatasetDGL(DATASET_NAME) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEICAYAAACktLTqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAQ90lEQVR4nO3df6zdd13H8eeLDoawMTp3O2rb0WkK0hEZWMsMKoMRVzekS2RJEZaiwwIOAwQcG6igsTrBgBpZZLKFgpOlhB+rCErt+KHRbXRzMNrRrLLRlpa2DOY20ULL2z/ud9lpe0/vae+592yfPh9J8/18P9/P93zf55Pb1/n2c885TVUhSWrL40ZdgCRp+Ax3SWqQ4S5JDTLcJalBhrskNchwl6QGGe5SJ8nfJPn9UdchDUN8n7takeRe4DVV9S+jrqWfx0KNaoN37jouJDlh1DVIM8lwVxOSfAQ4A/iHJA8luTxJJbk0yTbgpm7cx5J8O8l/J/lSkrN6HuNDSf64a5+bZEeStyTZk2RXkt/oGXtBks1JHkzyrSRv7Tn20iR3JLk/yb8n+Zl+Nc7I5Oi4ZLirCVV1CbAN+NWqOglY2x16IfAs4Pxu/7PAImAOcDtw/REe9mnAKcA84FLg/Ulmd8euBV5bVScDz+aRF4/nAdcBrwV+HPgAsC7JiYfWWFXvnvITl/ow3NW6d1XV/1TV/wJU1XVV9WBV7QPeBTwnySl9zv0h8EdV9cOq+gzwEPDMnmOLkzylqr5XVbd3/b8FfK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5ZJKnjrrW6dZvLnqOvzVJJTltKNdzzf3oJfkl4CHgw1X17K7vRcA7gAural+SOVW1Z5R1zpQ+8/E54H1V9dkkFwCXV9W5IyxzRiSZC8ytqtuTnAzcBlwEvBr4blVd1X3X0uyqetsIS50RR5iP+cBN3Zsv/gyg9fnoNxdVtTnJAuCDwE8DP1tVU/6Ql3fux6CqvgR895Du1wNXVdW+bsxxEezQdz4KeErXPoXj5HMOVbWrqm7v2g8CdwHzGP/6jTXdsDWMB1zz+s1HVX2uqvZ3w25mPOybdoSfDYD3AZdzyIc9p8JwH55nAL+Y5JYkX0zyc6MuaMTeBLwnyXbgz4ErR1zPjEuyEHgucAtwelXtgvG/5MCc0VU2GofMR6/fBD470/WMUu9cJHkZ8K2q+sowr2G4D88JwGzgHOB3gbVJJvoahuPF64E3V9UC4M3AtSOuZ0YlOQn4OPCmqnpg1PWMWr/5SPIOYD9w/ahqm2m9c8H4c38H8AfDvo7hPjw7gE/UuFuBHzH+hUDHq5XAJ7r2xxj/ptDjQpLHM/6X9/qqengOdndrrg+vvR43y3Z95oMkK4GXAq+s4+SXfxPMxU8BZwJfSXIv48tTtyd52lSvZbgPz6eAFwMkeQbwBI7vb77bCbywa78YuHuEtcyY7l9r1wJ3VdV7ew6tY/wFj25740zXNgr95iPJMuBtwMuq6vujqm8mTTQXVXVnVc2pqoVVtZDxm8TnVdW3p3y94+QFc6iSfBQ4l/E7893AO4GPANcBZwM/AN5aVTeNqsaZ1Gc+tgB/yfhy1f8Bv11Vt42qxpmS5BeAfwXuZPxfbwBvZ3ydeS1wBrANuLiqDv0ldHOOMB9/BZwI3Nf13VxVr5v5CmdOv7moqs/0jLkXWDKMd8sY7pLUIJdlJKlBhrskNchwl6QGGe6S1CDDXZIaZLhLUoMMd0lq0P8DooLeUsF0ATQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min/max : 15 24\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEICAYAAACktLTqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAQ80lEQVR4nO3de6xlZX3G8e/jjGC9UCBzIMMlDjZIi6YqjohVkYIXQONgKwasZqI0owa8pRcHbYpJQ0Jbe7GJl0wFnVQBR8QyrbZlOi2SNoIeEBUcEBCEgZE5SmlpbVHg1z/2mvZ43GfmnH05e3j5fpKTtda73nev335n59nrrH32mlQVkqS2PGHSBUiSRs9wl6QGGe6S1CDDXZIaZLhLUoMMd0lqkOEuzZHkhCTbJ12HNAzDXRqDJKuSVJLlk65Fj0+GuyQ1yHBXs5KsT3LZnLYPJ/mLJG9Jsi3Jg0m+m+Rtu3mc9yW5p+t7S5KTuvYndMe4PckPk2xKcmA37Opu+UCS/0zyovE8S6k/w10tuwQ4Ncl+AEmWAW8ALgZ2Aq8B9gPeAvxZkmPmPkCSo4BzgBdU1dOAVwF3drvfBZwGvAw4BPg34CPdvuO75f5V9dSq+srIn520G4a7mlVV3wOupxfAACcCP6qqa6rqi1V1e/V8GbgSeGmfh3kE2Bc4OskTq+rOqrq92/c24ANVtb2qHgI+CLze6+zaGxjuat3FwJnd+hu7bZKckuSaJPcneQA4FVgxd3BV3Qa8h15w70xyaZJDut1PB76Q5IHuMbbRezM4eJxPSFoIw12t+xxwQpLDgNcBFyfZF/g88CHg4KraH/gSkH4PUFUXV9VL6IV5AX/Y7bobOKWq9p/186SquqfrJ02M4a6mVdUMcBXwSeCOqtoG7EPvUssM8HCSU4BX9huf5KgkJ3ZvCP8D/De9s3OAjwPnJ3l613cqyZpu3wzwKPCMsTwxaQ8Mdz0eXAy8vFtSVQ/S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/cAf5zkbuBDwLl9+kxivhZSFyz9fN0IvLZbP52f/rLnLiOZr8dauH8M+AXgucAOer+ezrXHWx+MyUJqA3hxVR1D746ZZyc5fsx1LQcOAI4DfgfY1J39zTaJOVtIXbD087XLmcx/djyp1xjsvi5Y+vl6B/DeqjoceC9wYZ8+k5ivhdQFSz9fb+2Ocx3wNODHffqMZL4eU+FeVfdV1SNV9Sjwl/R+fZlrIrc+WGBtVNW93XIn8IX5+o3QduDy6vkq8Ci9GxXN7bPUc7aQuiYxXyRZDvwa8Nl5ukzkNbaAuiYxX2uBy7v1z81zvEnM10LqWvL5qqqbq+qVVfV8em/St/fpNpL5ekyFe5KVszZfR+9XnLkmcuuDhdSW5ClJnrZrHXhlv34j9tfAid0xn0nvA5q5d6CbxJztsa4JzRfAy4Gbq2r7PPsndXuN3dY1ofm6F3hZt34i0O9y0STma491TWK+khzULZ8A/B7w8T7dRjNf4/iUeESfNF9C7/LGT+i9k50F/BXwLeCb3ZNd2fU9BPjSrLGnAt+h9674gb2lNnqffn+j+7lp1LXNU9c+wKfpvWivB05c6jkbtK5JzFfX/ing7XP6TnS+FlLXhF5fLwGu6455LfD8vWG+FlLXhObr3d08fAe4gP+/S8DI58vbD0hSgx5Tl2UkSQtjuEtSgwx3SWqQ4S5JDTLcJalBhrskNchwl6QG/S9ZEHOVh6FkdwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min/max : 15 19\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEICAYAAACktLTqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXA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jhTvwW0Hbiqem4EHqF3oaLpfRZ7zIapaxLjRZIlwB8Dn5+hy0SeY0PUNYnxOhO4qlv+1xmON4nxGqauRR+vqrqrql5TVS+g9yL9wwHdFmS8HlPhnmRZ38M30fsTZ7qJXPpgmNqSHJrksH3LwGsG9VtgXwJe2R3zmfTeoJl+BbpJjNmsdU1ovABeDdxVVdtnWD+py2vst64JjdcO4OXd8iuBQdNFkxivWeuaxHglOaq7fwLwIeBTA7otzHiN413iBXqn+Qp60xu/ovdKdjbwGeA24Nbuh13W9X0qcE3ftqcC36f3qvhXB0pt9N79/l5327LQtc1Q18HAZ+k9aW8GXrnYYzbfuiYxXl37p4F3Tes70fEapq4JPb9eAmzujnkD8IIDYbyGqWtC4/Webhy+D1zMr68SsODj5eUHJKlBj6lpGUnScAx3SWqQ4S5JDTLcJalBhrskNchwl6QGGe6S1KD/B4tiq9FYI/TdAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min/max : 15 19\n"
     ]
    }
   ],
   "source": [
    "def plot_histo_graphs(dataset, title):\n",
    "    # histogram of graph sizes\n",
    "    graph_sizes = []\n",
    "    for graph in dataset:\n",
    "        graph_sizes.append(graph[0].number_of_nodes())\n",
    "    plt.figure(1)\n",
    "    plt.hist(graph_sizes, bins=20)\n",
    "    plt.title(title)\n",
    "    plt.show()\n",
    "    graph_sizes = torch.Tensor(graph_sizes)\n",
    "    print('min/max :',graph_sizes.min().long().item(),graph_sizes.max().long().item())\n",
    "    \n",
    "plot_histo_graphs(dataset.train,'trainset')\n",
    "plot_histo_graphs(dataset.val,'valset')\n",
    "plot_histo_graphs(dataset.test,'testset')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5120\n",
      "640\n",
      "1280\n",
      "(Graph(num_nodes=15, num_edges=26,\n",
      "      ndata_schemes={'feat': Scheme(shape=(2,), dtype=torch.float32)}\n",
      "      edata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}), tensor([0.0000, 0.1739, 0.1260]), tensor([[ 8.6957e-02,  1.7391e-01,  3.9386e-03],\n",
      "        [ 8.6957e-02,  8.6957e-02,  1.2333e-02],\n",
      "        [ 1.3043e-01,  1.3043e-01,  5.0524e-03],\n",
      "        [ 1.7391e-01,  1.7391e-01, -2.8644e-03],\n",
      "        [ 0.0000e+00,  8.6957e-02,  2.7865e-02],\n",
      "        [ 0.0000e+00,  8.6957e-02,  1.5610e-02],\n",
      "        [ 8.6957e-02,  1.7391e-01,  1.6334e-04],\n",
      "        [ 4.3478e-02,  1.3043e-01, -1.3372e-01],\n",
      "        [ 8.6957e-02,  1.7391e-01, -3.5295e-04],\n",
      "        [ 0.0000e+00,  4.3478e-02, -1.9937e-02],\n",
      "        [ 8.6957e-02,  1.7391e-01,  3.3696e-02],\n",
      "        [ 8.6957e-02,  1.7391e-01,  1.6398e-02],\n",
      "        [ 0.0000e+00,  8.6957e-02, -2.3538e-02],\n",
      "        [ 0.0000e+00,  1.7391e-01,  4.5834e-02],\n",
      "        [ 8.6957e-02,  1.7391e-01,  1.9520e-02]]))\n",
      "(Graph(num_nodes=15, num_edges=116,\n",
      "      ndata_schemes={'feat': Scheme(shape=(2,), dtype=torch.float32)}\n",
      "      edata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}), tensor([1.0000, 0.0870, 0.3918]), tensor([[ 0.0870,  0.0870,  0.0139],\n",
      "        [ 0.0870,  0.0870,  0.0391],\n",
      "        [ 0.0870,  0.0870,  0.0817],\n",
      "        [ 0.0870,  0.0870,  0.1862],\n",
      "        [ 0.0870,  0.0870,  0.2063],\n",
      "        [ 0.0870,  0.0870, -0.2749],\n",
      "        [ 0.0870,  0.0870,  0.0917],\n",
      "        [ 0.0435,  0.0435, -0.3119],\n",
      "        [ 0.0870,  0.0870,  0.0947],\n",
      "        [ 0.0435,  0.0870, -0.2202],\n",
      "        [ 0.0870,  0.0870,  0.1342],\n",
      "        [ 0.0435,  0.0870,  0.1725],\n",
      "        [ 0.0870,  0.0870, -0.1564],\n",
      "        [ 0.0000,  0.0870,  0.1655],\n",
      "        [ 0.0435,  0.0870, -0.2223]]))\n",
      "(Graph(num_nodes=15, num_edges=24,\n",
      "      ndata_schemes={'feat': Scheme(shape=(2,), dtype=torch.float32)}\n",
      "      edata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}), tensor([0.0000, 0.2609, 0.0815]), tensor([[ 0.0000,  0.1739,  0.0056],\n",
      "        [ 0.0000,  0.1304,  0.0999],\n",
      "        [ 0.0000,  0.2609,  0.0288],\n",
      "        [ 0.0000,  0.2174, -0.0659],\n",
      "        [ 0.0000,  0.0435, -0.0025],\n",
      "        [ 0.2174,  0.2174, -0.0158],\n",
      "        [ 0.0000,  0.2174,  0.0892],\n",
      "        [ 0.0000,  0.0435,  0.0025],\n",
      "        [ 0.1739,  0.1739, -0.0029],\n",
      "        [ 0.0000,  0.2609, -0.0445],\n",
      "        [ 0.0435,  0.1739,  0.0607],\n",
      "        [ 0.0000,  0.1739, -0.1130],\n",
      "        [ 0.0000,  0.2174, -0.0458],\n",
      "        [ 0.1304,  0.1304,  0.0419],\n",
      "        [ 0.0870,  0.1304, -0.0381]]))\n"
     ]
    }
   ],
   "source": [
    "print(len(dataset.train))\n",
    "print(len(dataset.val))\n",
    "print(len(dataset.test))\n",
    "\n",
    "print(dataset.train[0])\n",
    "print(dataset.val[0])\n",
    "print(dataset.test[0])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time (sec): 7.805322885513306\n"
     ]
    }
   ],
   "source": [
    "start = time.time()\n",
    "with open('data/graphtheoryprop/GraphTheoryProp'+'.pkl','wb') as f:\n",
    "        pickle.dump([dataset.train,dataset.val,dataset.test],f)\n",
    "print('Time (sec):',time.time() - start)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Test load function"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[I] Loading dataset GraphTheoryProp...\n",
      "train, test, val sizes : 5120 1280 640\n",
      "[I] Finished loading.\n",
      "[I] Data load time: 6.1830s\n"
     ]
    }
   ],
   "source": [
    "DATASET_NAME = 'GraphTheoryProp'\n",
    "dataset = LoadData(DATASET_NAME)\n",
    "trainset, valset, testset = dataset.train, dataset.val, dataset.test\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'data.graphtheoryprop.GraphTheoryPropDataset'>\n"
     ]
    }
   ],
   "source": [
    "batch_size = 10\n",
    "collate = GraphTheoryPropDataset.collate\n",
    "print(GraphTheoryPropDataset)\n",
    "train_loader = DataLoader(trainset, batch_size=batch_size, shuffle=True, collate_fn=collate)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
